package com.example.demo.config;

import com.example.demo.filter.FilterTest;
import com.example.demo.filter.FilterTest2;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FilterConfig {

    public FilterRegistrationBean filterTest2Registration()
    {
        FilterRegistrationBean registration = new FilterRegistrationBean();
        registration.setFilter(new FilterTest2());
        registration.addUrlPatterns("/*");
        registration.setName("filterTest2");
        registration.setOrder(FilterRegistrationBean.LOWEST_PRECEDENCE);
        return registration;
    }

    @Bean
    public FilterRegistrationBean filterTestRegistration()
    {
        FilterRegistrationBean registration = new FilterRegistrationBean();
        registration.setFilter(new FilterTest());
        registration.addUrlPatterns("/*");
        registration.setName("filterTest");
        registration.setOrder(FilterRegistrationBean.LOWEST_PRECEDENCE);
        return registration;
    }
}
